Resolving Theme URLs

From Documentation

Themes comprises of stylesheets and images. The URLs for those resources must be resolved once the theme changes.

Several APIs were available to redirect theme resources to the correct location.

ServletFns.encodeThemeURL(String) is for translating image locations inside *.css.dsp files.

ServletFns.resolveThemeURL(String) is for redirecting the retrieval of stylesheets inside a ThemeProvider.

Example Usage (inside *.css.dsp)

tr.z-row-over > td.z-row-inner, tr.z-row-over > .z-cell {
    background-image: url(${c:encodeThemeURL('~./zul/img/grid/column-over.png')});
}

Example Usage (inside a ThemeProvider):

...
public String beforeWidgetCSS(Execution exec, String uri) {
	if (uri.startsWith("~./zul/css/") ||
		uri.startsWith("~./js/zul/")) {
		
		uri = ServletFns.resolveThemeURL(uri);
	}
	
	return uri;
}
...



Last Update : 2013/04/07

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.